opentelemetry-api: fix SelectableGroups deprecation warning#5250
Open
herin049 wants to merge 2 commits into
Open
opentelemetry-api: fix SelectableGroups deprecation warning#5250herin049 wants to merge 2 commits into
herin049 wants to merge 2 commits into
Conversation
aabmass
approved these changes
Jun 5, 2026
Comment on lines
+32
to
+40
| # Python 3.10 entry_points() returns a dict-like SelectableGroups object. | ||
| # Use dict.values() instead of eps.values() to avoid the DeprecationWarning | ||
| # that SelectableGroups raises when calling .values(). | ||
| if isinstance(eps, dict): | ||
| return EntryPoints(itertools.chain.from_iterable(dict.values(eps))) | ||
| # Fallback for all other types | ||
| return EntryPoints( | ||
| ep for group in eps.groups for ep in eps.select(group=group) | ||
| ) |
Member
There was a problem hiding this comment.
I'm a bit confused on the cases being handled here. I thought the first isinstance check would cover everything >3.10.
Could you just add a comment at each branch indicating what python version and why?
Contributor
Author
There was a problem hiding this comment.
This line covers >3.11
if isinstance(eps, EntryPoints):
return epsThis line covers 3.10 and 3.11.
if isinstance(eps, dict):
return EntryPoints(itertools.chain.from_iterable(dict.values(eps)))This line should be unreachable in our supported version range, but I've kept it just in case.
return EntryPoints(
ep for group in eps.groups for ep in eps.select(group=group)
)I will add a comment. Thanks for the review!
Member
|
FYI I turned on auto merge for once all conversations are resolved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes bug where deprecation warnings are raised when calling
_as_entry_pointson Python versions 3.10/3.11.Fixes #5231
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Does This PR Require a Contrib Repo Change?
Checklist: